<template>
    <div>
        <ul class="clearfix" v-if="list.length > 0">
            <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
                <li class="clearfix pay-left-box b-g-f" v-for="(item,index) in list" :key="index">
                    <div class="order-start">
                        <span class="order-start-id">订单编号:{{item.order_sn}}</span>
                        <span class="order-start-data">{{$time(item.create_time)}}</span>
                    </div>
                    <div class="pay-right-box-wai clearfix" v-for="(items,indexs) in item.proList" :key="indexs">
                        <img :src="items.photo_s" alt="">
                        <div class="pay-right-box order-bottom">
                            <span class="pay-right-title">{{items.name}}</span>
                            <span class="pay-right-num">
                                ￥{{items.price}}
                                <em class="pay-num">X{{items.num}}</em>
                            </span>
                        </div>
                    </div>
                    <div class="pay-right-heji-box order-bottom">
                        <span class="pay-right-heji">
                            共{{item.buy_num}}件商品
                            <em class="pay-heji">合计：￥{{item.amount}}</em>
                        </span>
                    </div>
                </li>
            </van-list>
        </ul>
    </div>
</template>
<script>
export default {
    data(){
        return{
            list:[],
            loading:false,
            finished:false,
            page:0
        }
    },
    mounted(){
        this.onLoad()
    },
    methods:{
        onLoad(){
            this.getPatientOrders()
        },
        // 订单列表
        getPatientOrders(){
            this.page++
            this.$api.dietitian.getPatientOrders({page:this.page,id:this.$route.query.id}).then(resp=>{
                if(resp.code == 1){
                    this.loading = false
                    if(resp.data){
                        resp.data.forEach(e=>{
                            this.list.push(e)
                        })
                    }else{
                        this.finished = true
                    }
                }
            })
        }
    }
}
</script>


